package com.fr.dialog;

import com.fr.base.Inter;
import com.fr.cell.GUIUtils;
import com.fr.cell.ReportPane;
import com.fr.dialog.core.StylePane;
import com.fr.dialog.core.StylePane.PreivewArea;
import java.awt.BorderLayout;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Window;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class StyleDialog extends BaseDialog
{
  private ReportStylePane stylePane;

  public static StyleDialog showWindow(Window paramWindow)
  {
    if (paramWindow instanceof Frame)
      return new StyleDialog((Frame)paramWindow);
    return new StyleDialog((Dialog)paramWindow);
  }

  public StyleDialog(Frame paramFrame)
  {
    super(paramFrame);
    initComponents();
  }

  public StyleDialog(Dialog paramDialog)
  {
    super(paramDialog);
    initComponents();
  }

  protected void initComponents()
  {
    super.initComponents();
    JPanel localJPanel = (JPanel)getContentPane();
    this.stylePane = new ReportStylePane();
    localJPanel.add(this.stylePane, "Center");
    localJPanel.add(createControlButtonPane(), "South");
    setTitle(Inter.getLocText("Style"));
    setSize(600, 460);
    setModal(true);
    GUIUtils.centerWindow(this);
  }

  public void populate(ReportPane paramReportPane)
  {
    this.stylePane.populate(paramReportPane);
  }

  public boolean update(ReportPane paramReportPane)
  {
    return this.stylePane.update(paramReportPane);
  }

  private static class ReportStylePane extends StylePane
  {
    private StylePane.PreivewArea previewArea;
    private JPanel previewPane;

    public ReportStylePane()
    {
      setLayout(new BorderLayout());
      this.previewPane = new JPanel(new BorderLayout());
      add(this.previewPane, "North");
      this.previewPane.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("Preview") + ":"));
      this.previewArea = getPreviewArea();
      this.previewPane.add(this.previewArea, "Center");
      this.previewArea.addMouseListener(new StyleDialog.1(this));
      JTabbedPane localJTabbedPane = new JTabbedPane();
      add(localJTabbedPane, "Center");
      localJTabbedPane.addTab(Inter.getLocText("Format"), getFormatPane());
      localJTabbedPane.addTab(Inter.getLocText("Alignment"), new JPanel());
      localJTabbedPane.addTab(Inter.getLocText("Sytle-FRFont"), new JPanel());
      localJTabbedPane.addTab(Inter.getLocText("Border"), new JPanel());
      localJTabbedPane.addTab(Inter.getLocText("Background"), new JPanel());
      localJTabbedPane.addChangeListener(this.tabChangeActionListener);
    }

    static NameObject access$100(ReportStylePane paramReportStylePane)
    {
      return paramReportStylePane.nameObject;
    }

    static NameObject access$200(ReportStylePane paramReportStylePane)
    {
      return paramReportStylePane.nameObject;
    }
  }
}